/*
 * @version: 
 * @Author: yu
 * @Date: 2023-07-17 10:30:49
 * @LastEditors: Andy
 * @LastEditTime: 2023-07-17 16:00:40
 */
import React from 'react'
import { Button, Form, Input } from 'antd';
import { useNavigate } from 'react-router-dom'
import '../assets/css/index.css'

export default function Login() {
    const Navigate = useNavigate()
    const onFinish = (values) => {
        // console.log('Success:', values);
        Navigate('/index')
    };
    const onFinishFailed = (errorInfo) => {
        // console.log('Failed:', errorInfo);
    };
    return (
        <div className='main'>
            <div className='box'>
                <h1>登录</h1>
                <Form
                    name="basic"
                    labelCol={{
                        span: 8,
                    }}
                    wrapperCol={{
                        span: 16,
                    }}
                    style={{
                        maxWidth: 600,
                    }}
                    initialValues={{
                        remember: true,
                    }}
                    onFinish={onFinish}
                    onFinishFailed={onFinishFailed}
                    autoComplete="off"
                >
                    <Form.Item
                        label="用户名"
                        name="username"
                        rules={[
                            {
                                required: true,
                                message: '请输入用户名!',
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>

                    <Form.Item
                        label="密码"
                        name="password"
                        rules={[
                            {
                                required: true,
                                message: '请输入密码!',
                            },
                        ]}
                    >
                        <Input.Password />
                    </Form.Item>



                    <Form.Item
                        wrapperCol={{
                            offset: 8,
                            span: 16,
                        }}
                    >
                        <Button type="primary" htmlType="submit">
                            登录
                        </Button>
                    </Form.Item>
                </Form>
            </div>
        </div>
    )
}

